import { createStore, GetterTree, StoreOptions } from 'vuex'
import { app, State as AppState } from './modules/app'
import { user, State as UserState } from './modules/user'

type State = AppState & UserState

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getters: GetterTree<any, State> = {
  showSide: state => state.app.showSide,
  routeTabs: state => state.app.routeTabs,
  userInfo: state => state.user.userInfo,
  routes: state => state.user.routes,
  asyncRoutes: state => state.user.asyncRoutes
}

const options: StoreOptions<State> = {
  modules: {
    app,
    user
  },
  getters
}

export default createStore(options)
